package com.app.micaihu.bean.news;

import android.view.View;

import com.app.micaihu.R;
import com.app.micaihu.custom.view.CustomImageView;
import com.app.utils.util.ViewSizeUtils;
import com.app.utils.util.image.LoadImageUtils;

/**
 * 游戏视频小图
 * Created by linkai on 2016/7/17.
 */
public class ViewGameVideoSmallImg extends ViewNewsParent {

    public CustomImageView smallImg;
    public View videoPic;

    private int width = 324;
    private int height = 232;

    public ViewGameVideoSmallImg(View convertView) {
        initView(convertView);
    }

    public ViewGameVideoSmallImg(View convertView, int width, int height) {
        this.width = width;
        this.height = height;
        initView(convertView);
    }

    /**
     * 初始化控件
     * @param convertView
     */
    public void initView(View convertView) {
        super.initView(convertView);
        this.smallImg = (CustomImageView) convertView.findViewById(R.id.item_small_image);
        this.videoPic = convertView.findViewById(R.id.item_video_pic);
        ViewSizeUtils.changeViewAuto1080(this.smallImg, width, height);
        ViewSizeUtils.changeViewAuto1080(this.videoPic, width, height);
        convertView.setTag(this);
    }

    /**
     * 加载数据
     * @param newsEntity
     */
    public void loadData(NewsEntity newsEntity){
        super.loadData(newsEntity);
        LoadImageUtils.getInstance().loadWifiImage(this.smallImg, newsEntity.getArticleThumb()[0]);
        if (this.mark.getVisibility() == View.GONE) {
            this.mark.setVisibility(View.VISIBLE);
        }
    }


}
